/*
 * TCSS 445 - Major Project
 * 
 * Author: Chris Davidson
 * Author: Dallas Rosson
 */
package controller;

import java.sql.Connection;
import java.sql.DriverManager;

/**
 * SQLConnectionMaker
 * 
 * Creates a connection to a sql database.
 * 
 * @author Dallas Rosson
 * @author Chris Davidson
 * @version 1.0, 5/28/2012
 */
public class SQLConnectionMaker {

  public static final String DATABASE_USER = "user";

  public static final String DATABASE_PASSWORD = "password";

  public static final String MYSQL_AUTO_RECONNECT = "autoReconnect";

  public static final String MYSQL_MAX_RECONNECTS = "maxReconnects";

  public static Connection getConnection() throws Exception {
      Class.forName ("com.mysql.jdbc.Driver").newInstance ();
      Connection conn = DriverManager.getConnection(
          "jdbc:mysql://localhost/445_nol_ChrisDavidsonDallasRosson",
          "root",
          "library" );
    return conn;
  }

  public static void main(String[] args) {
    Connection conn = null;
    
    try {
      // Get connection to an Oracle database.
      conn = getConnection();
      System.out.println("conn=" + conn);
      
    } catch (final Exception the_e) {
      // handle the exception
      the_e.printStackTrace();
      System.exit(1);
      
    } finally {        
      // Release database resources.
      try {
        conn.close();
      } catch (Exception ignore) {
      }
    }
  }
}